# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BinaryAuthorization.V1.Model.Attestor do
  @moduledoc """
  An attestor that attests to container image artifacts. An existing attestor cannot be modified except where indicated.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Optional. A checksum, returned by the server, that can be sent on update requests to ensure the attestor has an up-to-date value before attempting to update it. See https://google.aip.dev/154.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. The resource name, in the format: `projects/*/attestors/*`. This field may not be updated.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the attestor was last updated.
  *   `userOwnedGrafeasNote` (*type:* `GoogleApi.BinaryAuthorization.V1.Model.UserOwnedGrafeasNote.t`, *default:* `nil`) - This specifies how an attestation will be read, and how it will be used during policy enforcement.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :etag => String.t() | nil,
          :name => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :userOwnedGrafeasNote =>
            GoogleApi.BinaryAuthorization.V1.Model.UserOwnedGrafeasNote.t() | nil
        }

  field(:description)
  field(:etag)
  field(:name)
  field(:updateTime, as: DateTime)
  field(:userOwnedGrafeasNote, as: GoogleApi.BinaryAuthorization.V1.Model.UserOwnedGrafeasNote)
end

defimpl Poison.Decoder, for: GoogleApi.BinaryAuthorization.V1.Model.Attestor do
  def decode(value, options) do
    GoogleApi.BinaryAuthorization.V1.Model.Attestor.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BinaryAuthorization.V1.Model.Attestor do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
